<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="认领列表" libs=["table"]/>
<div class="container-div" id="_app">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <@f.form id="module-form">
            <div class="select-list">
                <ul>
                    <li class="select-time">
                        <label>文件名称： </label>
                        <@f.input id="title" name="title"/>
                    </li>
                    <li class="select-time">
                        <label>上传作者： </label>
                        <@f.input id="username" name="username"/>
                    </li>
                    <li>
                        <@ctx.i18n text = "状态"/>：
                        <@f.select name="kind" dictType="sys_source_kind" blankValue="" blankLabel="所有"/>
                    </li>
                    <li>
                        <@ctx.i18n text = "分类"/>：
                        <@f.select name="type" dictType="sys_file_type" blankValue="" blankLabel="所有"/>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                class="fa fa-search"></i>  <@ctx.i18n text = "查询"/></a>
                        <a class="btn btn-warning btn-rounded btn-sm" onclick="opt.form.reset()"><i
                                class="fa fa-refresh"></i> <@ctx.i18n text = "重置"/></a>
                    </li>
                </ul>
            </div>
            <input type="hidden" name="bidedNoticeName" value="" />
            <input type="hidden" name="bidedNoticeUrl" value="" />
        </@f.form>
    </div>
    <@table id="bootstrap-table">
    <@shiro.hasPermission name="bpm:information:add">
    <a class="btn btn-success"onclick="opt.operate.add(0)">
        <i class="fa fa-plus"></i> <@ctx.i18n text = "上传"/>
    </a>
</@shiro.hasPermission>
<@shiro.hasPermission name="bpm:information:edit">
<a class="btn btn-primary" onclick="opt.operate.edit()">
    <i class="fa fa-edit"></i> <@ctx.i18n text = "修改"/>
</a>
</@shiro.hasPermission>
<@shiro.hasPermission name="bpm:information:del">
<a class="btn btn-danger multiple disabled" onclick="opt.operate.delAll()">
    <i class="fa fa-remove"></i> <@ctx.i18n text = "删除"/>
</a>
</@shiro.hasPermission>
</@table>
</div>
</div>
<@footer>
<script type="text/javascript">
    var statusDatas = ${dict.getDictListJson('sys_file_type')};
    var editFlag = "${permission.hasPermi("
    bpm:manager:form
    ")}";
    var listFlag = "${permission.hasPermi("
    bpm:manager:add
    ")}";
    // var categoryDatas = ${dict.getDictListJson('sys_bpm_category')};
    var prefix = baseURL + "bpm/information";

    $(function () {
        var options = {
            url: prefix + "/informationList",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect: true,
            sortName: "id",
            delUrl: prefix + "/del",
            addUrl: prefix + "/add",
            editUrl: prefix + "/edit/{id}",//认领箱
            uniqueId: 'id', /* 唯一ID */
            columns: [
                // {field: 'selectItem', radio: true},
                {
                    title: $.i18n.prop("序号"), width: 5, align: "center", formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                // {field : 'id',title : '<@ctx.i18n text = "编号"/>'},
                {field:'title',   title: '<@ctx.i18n text = "文件名称"/>'},
                // {field: 'oprate', title: '操作', width: 100, align: 'center', valign: 'middle', formatter: aFormatter }, //添加超链接的方法
                {field:'url',     title: '<@ctx.i18n text = "浏览地址"/>',align: 'center', valign: 'middle',formatter: function (value, row, index) {
                        return "<a href='/fast/"+value+"' target='_blank' download>"+value+"</a>";
                    }},
                {field:'size',    title: '<@ctx.i18n text = "文件大小"/>'},
                {field:'descript',title: '<@ctx.i18n text = "文件描述"/>'},
                {field:'username',title: '<@ctx.i18n text = "上传作者"/>'},
                {field:'dateline',title: '<@ctx.i18n text = "上传时间"/>'}
            ]
        };
        $.table.init(options);
    });

    /* 挂起流程定义 */
    function disable(id) {
        opt.modal.confirm("确认要挂起流程定义吗？", function () {
            opt.operate.post(prefix + "/status", {"deploymentId": id, "status": 1});
        })
    }

    /* 激活流程定义 */
    function enable(id) {
        opt.modal.confirm("确认要激活流程定义吗?", function () {
            opt.operate.post(prefix + "/status", {"deploymentId": id, "status": 0});
        })
    }

    function taskFromEdit(id) {
        // opt.modal.confirm("确认要删除流程定义吗?", function() {
        //  opt.modal.openTab(prefix + "/edit", { "id": id});
        console.log("1111111111");
        console.log(id);
        console.log("11111111");
        opt.modal.openTab("认领修改", prefix + "/edit/" + id);
        // })
    }

    function taskFrom(id) {
        opt.modal.openTab("关联表单", prefix + "/taskfrom/" + id);
    }

    /*预览*/
    function preview(id) {
        var options = {
            url: prefix + "/preview/" + id,
            title: '<i class="fa icon-picture"></i> <@ctx.i18n text = "流程图"/>',
            btn: ['<i class="fa fa-close"></i> ' + $.i18n.prop("取消")],
            width: $(top.window).width() - 300,
            height: $(top.window).height() - 400
        };
        opt.modal.openMainWin(options);
    }

    /*预览XML*/
    function preXml(id) {
        var options = {
            url: prefix + "/xml/" + id,
            title: '<i class="fa fa-file-code-o"></i> <@ctx.i18n text = "BPMN2.0流程文件"/>',
            btn: ['<i class="fa fa-close"></i> ' + $.i18n.prop("取消")],
        };
        opt.modal.openMainWin(options);
    }

    /*生成代码*/
    function xmlDownload(id, name) {
        opt.modal.confirm("确定要下载[" + name + "]流程文件吗?", function () {
            location.href = prefix + "/download/" + id;
            opt.modal.msg('执行成功,正在下载请稍后…');
        })
    }




</script>
</@footer>
</@pageTheme>